#include <ros/ros.h>
#include <test_topic_roscpp/mymsg.h>

int main(int argc, char** argv)
{
	ros::init(argc,argv,"send");
	
	ros::NodeHandle handle;
	
	ros::Publisher sender = handle.advertise<test_topic_roscpp::mymsg>("tangyuan",1);

	ros::Rate loop_rate(1.0);//频率为1Hz

	test_topic_roscpp::mymsg msg;
	msg.id=1;
	msg.value=1.0;
	msg.str="tangyuan";
	while(ros::ok())
	{
		msg.id++;
		msg.value *=1.66;
		sender.publish(msg);//发送
		ROS_INFO("send msg: cnt = %d , value = %f",msg.id,msg.value);
		//休眠
		loop_rate.sleep();
	}
	return 0;
}
